<form class="form-inline" method="get">
<p>订单总金额：<span style="color: red">{$all_money}</span></p>
    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" name="user_condition" value="{$user_condition}"
                   placeholder="会员手机|会员姓名|会员ID">
        </div>
    </div>

    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" name="or_condition" value="{$or_condition}"
                   placeholder="订单ID|订单号">
        </div>
    </div>

    <div class="form-group col-xs-4">
        <div class="col-xs-12">
            <span style="">创建时间</span>{include file="public/dateRangePicker" picker-name="time_range" /}
        </div>
    </div>
    <input type="hidden" name="status" value="{$status}">
    <div class="form-group col-xs-2" style="">
        <div class="col-xs-12">
            <button type="submit" class="btn btn-success">
                搜索
            </button>
            <button type="button" id="export" class="btn btn-success">
                导出订单
            </button>
        </div>
    </div>
</form>

<hr>

<table class="table table-striped">
    <thead>
    <tr>
        <td>ID</td>
        <td>买家</td>
        <td>订单</td>
        <td>订单状态</td>
        <td>订单金额</td>
        <td>创建时间</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="item"}
    <tr>
        <td>{$item.id}</td>
        <td>
            <p><label class="label label-danger">{$item.nick_name}</label></p>
            <p><label class="label label-success">{$item.mobile}</label></p>
        </td>
        <td>
            <p>单号：{$item.order_sn}</p>
        </td>
        <td>
            <p>
                {if $item['order_status']==0}
                <label class="label label-danger">未支付</label>
                {elseif $item['order_status']==1}
                <label class="label label-warning">待发货</label>
                {elseif $item['order_status']==2}
                <label class="label label-default">待收货</label>
                {elseif $item['order_status']==3}
                <label class="label label-default">待评价</label>
                {elseif $item['order_status']==4}
                <label class="label label-default">已取消</label>
                {elseif $item['order_status']==5}
                <label class="label label-default">已完成</label>
                {else}
                无效订单
                {/if}
            </p>
        </td>
        <td>
            <p>
                <label class="label label-warning">金额：{$item.money}</label><br>
            </p>
            <p><label class="label label-default">积分抵扣：{$item.score_fee}</label></p>
        </td>
        <td>
            <p>{$item.create_time|show_datetime}</p>
        </td>
        <td>
            <div class="btn-group">
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    操作
                    <span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li>
                        <a href="javascript:void(0)" onclick="modal('{:url(\'order_info\',array(\'id\'=>$item[\'id\']))}', '订单详情')">
                            订单详情
                        </a>
                    </li>
                    {if $item['order_status']==0}
                    <li>
                        <a href="javascript:void(0)" data-toggle="confirm"
                           data-title="确认付款"
                           data-content="确认付款后买家无需再付款，谨慎操作，确认付款？"
                           data-url="{:url('confirm_pay',array('id'=>$item['id']))}">
                            确认付款
                        </a>
                    </li>
                    {elseif $item['order_status']==1}
                    <li>
                        <a href="javascript:void(0)" onclick="send_order('{$item.id}')">
                            确认发货
                        </a>
                    </li>
                    {elseif $item['order_status']==2}
                    <li>
                        <a href="javascript:void(0)" data-toggle="confirm"
                        data-title="确认收货"
                        data-content="确认收货后将发放佣金，操作不可逆，谨慎操作，确认收货？"
                        data-url="{:url('confirm_receive',array('id'=>$item['id'],'uid'=>$item['uid']))}">
                            确认收货
                        </a>
                    </li>
                    {/if}
                    {if $item['order_status']==4}
                    <li>
                        <a href="javascript:void(0)" data-toggle="confirm"
                           data-title="删除订单"
                           data-content="订单将会被删除，确认删除？"
                           data-url="{:url('remove',array('id'=>$item['id']))}">
                            删除
                        </a>
                    </li>
                    {/if}
                    <li role="separator" class="divider"></li>
                </ul>
            </div>
        </td>

    </tr>
    {/volist}
    </tbody>
</table>

<div class="row">
    <div class="col-xs-12" style="text-align: right;">
        {$list->render()}
    </div>
</div>

<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<script type="application/javascript">
    $(function () {
        /*修改标题*/
        var title="{$templateTitle}";
        $(".dakq-nav-title").text(title);
        //获取分类
        $("#type-selector").select2({
            placeholder: "选择订单类型",
            allowClear: true
        });
        $("#export").click(function () {
            let url = location.href;
            $("form").attr("action", "{:url('order_export')}");
            $("form").submit();
            $("form").attr("action", url);
        });
    });

    function send_order(order_id) {
        modal('{:url("send_order")}?order_id='+order_id, "订单发货", "60%", "60%");
    }
</script>